﻿<link href="../Public/css/style.css" rel="stylesheet" type="text/css" />
<!-- 加载头部公共文件 -->
<include file="../Public/head" />
<link rel="stylesheet" href="/Public/Js/ZTree/demoStyle/demo.css" type="text/css">
<link rel="stylesheet" href="/Public/Js/ZTree/zTreeStyle/zTreeStyle.css" type="text/css">
<script type="text/javascript" src="/Public/Js/ZTree/jquery.ztree-2.6.min.js"></script>



<form method='post' action="__URL__" >
  <table width="98%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="8" height="8"><img src="../Public/images/index1_28.gif" width="8" height="39" /></td>
      <td width="99%" background="../Public/images/index1_40.gif">&nbsp;</td>
      <td width="8" height="8"><img src="../Public/images/index1_43.gif" width="8" height="39" /></td>
    </tr>
    <tr>
      <td background="../Public/images/index1_45.gif"></td>
      <td bgcolor="#FFFFFF" style="height:490px; vertical-align:top;"><table width="100%" border="0" cellspacing="10" cellpadding="0">

          <tr>
            <td>
             	<fieldset >
             		<legend>设置用户栏目权限</legend>
                    <ul id="tree_sort" class="tree"></ul>
                    <br />
                    <div class="row">&nbsp;</div>				
                        <div class="impBtn hMargin fLeft shadow" >
                          <input type="button" name="Submit" value="保存"  class="save imgButton" onClick="save()" />
                        </div>					
                    </div>
				</fieldset>
            </td>
          </tr>
          <tr>
            <td></td>
          </tr>
        </table>
          <h3>&nbsp;</h3>
      </td>
      <td background="../Public/images/index1_47.gif"></td>
    </tr>
    <tr>
      <td width="8" height="8"><img src="../Public/images/index1_91.gif" width="8" height="8" /></td>
      <td background="../Public/images/index1_92.gif"></td>
      <td width="8" height="8"><img src="../Public/images/index1_93.gif" width="8" height="8" /></td>
    </tr>
  </table>

</form>


<!-- js 脚本 -->
<script language="javascript">
<!--
var zTreeObj;
var setting = {
	isSimpleData : true,	
    treeNodeKey : "id",
    treeNodeParentKey : "pId",
	checkable : true
}; //zTree的参数配置）
var zNodes = [
<volist name="list" id="vo" key="k">

				{ id:{$vo.id},pId:{$vo.pid},name:"{$vo.name}",checked:{$vo.id|hasRights=$uid}}<if condition="$k neq $total" >,</if>				
</volist>			
			]; //zTree的数据属性解

$(document).ready(function(){

	setListStyle("tb_list");
	zTreeObj = $("#tree_sort").zTree(setting, zNodes);
	
});

function save()
{
	
	var url = '__URL__/save/';
	var s='';
	var arrCheckedNodes = zTreeObj.getCheckedNodes();
	for(var i=0;i<arrCheckedNodes.length;i++) {
		s += arrCheckedNodes[i].id;
		if( i<arrCheckedNodes.length-1 )
			s += ',';
	}

	showLoading(function() {
	
		$.ajax({
			url:url,
			type:'POST',
			data: "sorts="+s+"&uid={$uid}",
			success: function( rt ) {
				
				if( rt == '1' )
				{
					alert('保存成功！');
				}
				else	
					alert('操作失败！');
				hideLoading();
	
			}
		});
	
	});	

}





//-->
</script>
<!-- 主页面结束 -->
<!-- 加载尾部公共文件 -->
<include file="../Public/foot" />